//
//  UIImage+Resource.m
//  XPhotoLibraryKit
//
//  Created by Wu,Xinting on 2018/3/21.
//

#import "UIImage+Resource.h"
#import "XViewController.h"

@implementation UIImage (Resource)

+ (UIImage *)imageForName:(NSString *)name {
    static NSBundle *resBundle = nil;
    if (!resBundle) {
        NSBundle *bundle = [NSBundle bundleForClass:XViewController.class];
        NSString *resPath = [bundle pathForResource:@"XPhotoLibraryKit" ofType:@"bundle"];
        resBundle = [NSBundle bundleWithPath:resPath];
    }
    return [UIImage imageNamed:name inBundle:resBundle compatibleWithTraitCollection:nil];
}

@end
